<?php


namespace App\Controller\Cooperative;


use App\Annotation\OperationLog;
use App\Controller\AbstractController;
use App\Request\Cooperative\WithdrawalCashListRequest;
use App\Request\Cooperative\WithdrawalCashRejectRequest;
use App\Request\Cooperative\WithdrawalCashRequest;
use App\Service\Cooperative\WithdrawalCashService;
use Hyperf\Di\Annotation\Inject;

class WithdrawalCashController extends AbstractController
{
    /**
     * @Inject()
     * @var WithdrawalCashService
     */
    protected $withdrawalCashService;

    /**
     * 列表
     * @OperationLog(event="查看提现申请",platform="cooperative")
     * @param WithdrawalCashRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function cashList(WithdrawalCashListRequest $request)
    {
       $validated = $request->validated();
       $data = $this->withdrawalCashService->index($validated);
       return $this->response->success($data);
    }

    /**
     * 确认
     * @OperationLog(event="确认提现",platform="cooperative")
     * @param WithdrawalCashRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function ackApply(WithdrawalCashRequest $request)
    {
        $validated = $request->validated();
        $data = $this->withdrawalCashService->ackApply($validated);
        return $this->response->success($data);
    }

    /**
     * 驳回
     * @OperationLog(event="驳回提现",platform="cooperative")
     * @param WithdrawalCashRejectRequest $request
     * @return mixed|\Psr\Http\Message\ResponseInterface
     */
    public function rejectApply(WithdrawalCashRejectRequest $request)
    {
        $validated = $request->validated();
        $data = $this->withdrawalCashService->rejectApply($validated);
        return $this->response->success($data);
    }


    /**
     * 已打款
     * @OperationLog(event="提现已打款",platform="cooperative")
     */
    public function paidApply(WithdrawalCashRequest $request)
    {
        $validated = $request->validated();
        $data = $this->withdrawalCashService->paidApply($validated);
        return $this->response->success($data);
    }

}